<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>

  function Cat(name, color) {
    this.name = name;
    this.color = color;
  }


  // Cat.prototype.constructor = Cat;
  Cat.prototype.species = "cat";
  Cat.prototype.call = function () {
    console.log("喵喵");
  }
  Cat.prototype.skill = function () {
    console.log("捉老鼠");
  }

  // 此方法虽然存在原型对象中, 但是调用时 是由实例化对象访问的 Tom.say() =>this指向调用此方法的实例化对象
  Cat.prototype.say = function () {
    console.log(this.name, this.color);
  }

  console.dir(Cat);  //打印 对象或函数的详细属性和方法

  var Tom = new Cat("Tom", "black");
  console.log(Tom);
</script>

</html>